<?php
// +----------------------------------------------------------------------
// | BaseModel.class.php
// +----------------------------------------------------------------------
// | Author: alexander <gt199899@gmail.com>
// +----------------------------------------------------------------------
// | Data: 2014-10-31下午12:30:26
// +----------------------------------------------------------------------
// | Version: 2014-10-31下午12:30:26
// +----------------------------------------------------------------------
// | Copyright: ShowMore
// +----------------------------------------------------------------------
namespace Common\Model;
use Think\Model;
class BaseModel extends Model{

	/**
	 * 初始化
	 * !CodeTemplates.overridecomment.nonjd!
	 * @see \Think\Model::_initialize()
	 */
	protected function _initialize(){}

	/**
	 * errorCheck
	 * 错误检测
	 * @access public
	 * @param boolean $result 检测目标
	 * @param boolean $log 是否记录日志
	 * @return return_type
	 * @author alexander<gt199899@gmail.com>
	 * @version 2014-10-31 下午4:59:46
	 * @copyright Show More
	 */
	public function errorCheck($result, $log = true){
		$result = $result === false ? false : true;
		$log and \Think\Log::record($this->getLastSql(), \Think\Log::SQL);
		$result or E("[Error]:".$this->getDbError());
	}

}